using System;
using System.Windows;
using System.Windows.Controls;
using ibba.src.sl.componentes;


namespace ibba.src.noriskbo //.code.helpers
{
    public class MainPageHelper
    {
        //public delegate void RetornoPesquisa<T>(T pValor);
        //public event RetornoPesquisa<ServiceBarraPesquisa.ItemBarraPesquisa> PesquisaClick;

        //private static readonly MainPageHelper _instancia = new MainPageHelper();

        //private MainPageHelper()
        //{
        //    Configurar();
        //}

        //public static MainPageHelper GetInstance
        //{
        //    get
        //    {
        //        return _instancia;
        //    }
        //}

        public MainPageHelper()
        {
            Configurar();
        }
        
        //public MainPageHelper(Page pPageInCache)
        //{
        //    pPageInCache.NavigationCacheMode = System.Windows.Navigation.NavigationCacheMode.Enabled;
        //    Configurar();
        //}

        private void Configurar()
        {
            //this.Main = (MainPageLM)Application.Current.RootVisual;
            this.Main = (MainPageLM)(Application.Current.RootVisual as Grid).Children[0];
                        
            this.Main.barraPesquisa.SomenteOperacoesReserva = false; //valor default;
            this.Main.barraPesquisa.ClearEventPesquisar();        
        }
        
        private MainPageLM Main { get; set; }

        public void NavigateTo(string uri)
        {
            this.Main.NavigateTo(uri);
        }

        public void NavigateTo(string uri, UriKind pUriKind)
        {
            this.Main.NavigateTo(uri, pUriKind);
        }

        public ControlMenuBar BarraMenu
        {
            get { return this.Main.barraMenu; }
        }

        public SearchBar BarraPesquisa
        {
            get { return this.Main.barraPesquisa; }
        }

    }
}
